import { ArcoDesignPlugin } from "@arco-plugins/unplugin-react";
import { defineConfig } from "@rsbuild/core";
import { pluginLess } from "@rsbuild/plugin-less";
import { pluginReact } from "@rsbuild/plugin-react";
import { TanStackRouterRspack } from "@tanstack/router-plugin/rspack";
import { resolve } from "node:path";

export default defineConfig({
	plugins: [pluginReact(), pluginLess()],
	tools: {
		rspack: {
			plugins: [
				new ArcoDesignPlugin({
					theme: "@arco-themes/react-diancha",
				}),
				TanStackRouterRspack({
					target: "react",
					autoCodeSplitting: true,
					routeFileIgnorePrefix: "components",
				}),
			],
		},
	},
	html: {
		template: "./index.html",
	},
	source: {
		alias: {
			"@": resolve(__dirname, "src"),
		},
	},
});
